{include file="public/layout" /}

<body class="bodystyle" class="eyou_body_xin">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    <div class="fixed-bar ">
        <div class="item-title">
            <a class="back_xin" href="{:url('Weapp/index')}" title="返回"><i class="iconfont e-fanhui"></i></a>
            <div class="subject">
                <h3>物流公司</h3>
                <h5></h5>
            </div>
        </div>
    </div>
    <div class="flexigrid">
        <div class="mDiv pt0">
            <div class="ftitle">
                {eq name="$select" value="1"}
                <h5>共 {$pager->totalRows} 个快递公司，已选中 {$selectNum} 个快递公司，选中后将在运费模板选择物流公司时显示</h5>
                {else/}
                <h5>共{$pager->totalRows}条数据</h5>
                {/eq}
            </div>
            <div title="刷新数据" class="pReload"><i class="fa fa-refresh"></i></div>
            <form class="navbar-form form-inline" id="searchForm" action="{:url('Shop/order_express')}" method="get" onsubmit="layer_loading('正在处理');">
                {$searchform.hidden|default=''}
                <div class="sDiv">
                    <div class="sDiv2">
                        <input type="text" size="30" name="keywords" value="{$Request.param.keywords}" class="qsbox" placeholder="名称搜索...">
                        <input type="submit" class="btn" value="搜索">
                        <i class="iconfont e-sousuo"></i>
                    </div>
                </div>
            </form>
        </div>
        <div class="hDiv">
            <div class="hDivBox">
                <table cellspacing="0" cellpadding="0" style="width: 100%">
                    <thead>
                        <tr>
                            <th axis="col1" class="w10">
                                <div class="tc"></div>
                            </th>
                            <th abbr="article_show" axis="col5" class="w40">
                                <div class="tc">ID</div>
                            </th>
                            <th abbr="ac_id" axis="col4">
                                <div class="text-l10">公司名称</div>
                            </th>
                            <th axis="col1" class="w80">
                                <div class="tc">状态</div>
                            </th>
                            <th axis="col1" class="w60">
                                <div class="tc">排序</div>
                            </th>
                        </tr>
                    </thead>
                </table>
            </div>
        </div>
        <div class="bDiv" style="height: auto;">
            <div id="flexigrid" cellpadding="0" cellspacing="0" border="0">
                <table style="width: 100%;">
                    <tbody>
                    {empty name="ExpressData"}
                        <tr>
                            <td class="no-data" align="center" axis="col0" colspan="50">
                                <div class="no_row">
                                    <div class="no_pic"><img src="__SKIN__/images/null-data.png"></div>
                                </div>
                            </td>
                        </tr>
                    {else/}
                        {foreach name="ExpressData" item="vo" key="k" }
                        <tr>
                            <td class="">
                                <div class="w10 tc"></div>
                            </td>
                            <td class="sort">
                                <div class="w40 tc">
                                    {if condition="$pager->nowPage > 1"}
                                        {$pager->listRows * ($pager->nowPage-1) + $k+1}
                                    {else /}
                                        {$k+1}
                                    {/if}
                                </div>
                            </td>
                            <td style="width: 100%">
                                <div class="text-l10">
                                    {$vo.express_name}
                                </div>
                            </td>
                            <td>
                                <div class="w80 tc">
                                    {if condition="$vo['is_choose'] eq 1"}
                                        <span class="yes" onClick="changeTableVal('shop_express', 'express_id', '{$vo.express_id}', 'is_choose', this);" data-yestext='<i class="fa fa-check-circle"></i>启用' data-notext='<i class="fa fa-ban"></i>禁用'><i class="fa fa-check-circle"></i>启用</span>
                                    {else /}
                                        <span class="no" onClick="changeTableVal('shop_express', 'express_id', '{$vo.express_id}', 'is_choose', this);" data-yestext='<i class="fa fa-check-circle"></i>启用' data-notext='<i class="fa fa-ban"></i>禁用'><i class="fa fa-ban"></i>禁用</span>
                                    {/if}
                                </div>
                            </td>
                            <td class="sort">
                                <div class="w60 tc">
                                    {eq name="'Shop@express_is_choose'|is_check_access" value="1"}
                                    <input type="text" onkeyup="this.value=this.value.replace(/[^\d]/g,'');" onpaste="this.value=this.value.replace(/[^\d]/g,'')" onchange="changeTableVal('shop_express','express_id','{$vo.express_id}','sort_order',this);" size="4"  value="{$vo.sort_order}" />
                                    {else /}
                                        {$vo.sort_order}
                                    {/eq}
                                </div>
                            </td>
                        </tr>
                        {/foreach}
                    {/empty}
                    </tbody>
                </table>
            </div>
            <div class="iDiv" style="display: none;"></div>
        </div>
        <div class="tDiv">
            <div class="tDiv2">
                {eq name="'Shop@express_is_choose'|is_check_access" value="1"}
                <div class="fbutton">
                    <a onclick="allSelect(1);" data-url="{:U('Shop/express_is_choose')}" class="layui-btn layui-btn-primary">
                        <span>全部选中</span>
                    </a>
                </div>
                <div class="fbutton">
                    <a onclick="allSelect(0);" data-url="{:U('Shop/express_is_choose')}" class="layui-btn layui-btn-primary">
                        <span>全部取消</span>
                    </a>
                </div>
                {/eq}
                {include file="public/page" /}
            </div>
            <div style="clear:both"></div>
        </div>
    </div>
</div>

<script type="text/javascript">
    $(document).ready(function(){

        $(document).keydown(function(event){
            if (event.keyCode ==13) {
                $('#searchForm input[type=text]').each(function(index, item){
                    if ($(item).is(':focus')) {
                        $('#searchForm').submit();
                    }
                });
            }
        });

        // 表格行点击选中切换
        $('#flexigrid > table>tbody >tr').click(function(){
            $(this).toggleClass('trSelected');
        });

        // 点击刷新数据
        $('.fa-refresh').click(function(){
            location.href = location.href;
        });
    });

    // 全部选中/全部取消
    function allSelect(is_choose) {
        var selectNum = "{$selectNum}";
        var totalRows = "{$pager->totalRows}";
        var msg = '';
        if (1 == is_choose) {
            if (selectNum == totalRows) {
                layer.msg('已全部选中，无需重复操作', {time: 2000});
                return false;
            }
            msg = '执行此操作则将 <span style="color: red;">' + totalRows + '</span> 个快递公司全部选中，是否确认？';
        } else {
            if (selectNum == 0) {
                layer.msg('已全部取消，无需重复操作', {time: 2000});
                return false;
            }
            msg = '执行此操作则将 <span style="color: red;">' + totalRows + '</span> 个快递公司全部取消选中，是否确认？';
        }
        layer.confirm(msg, {
            shade: layer_shade,
            area: ['480px', '190px'],
            move: false,
            title: '提示',
            btnAlign:'r',
            closeBtn: 3,
            btn: ['确定', '取消'] ,//按钮
            success: function () {
                  $(".layui-layer-content").css('text-align', 'left');
              }
        },function(){
            layer_loading('正在处理');
            $.ajax({
                url: "{:url('Shop/express_is_choose')}",
                data: {is_choose: is_choose, _ajax: 1},
                type:'post',
                dataType:'json',
                success:function(res) {
                    layer.closeAll();
                    if (1 == res.code) {
                        layer.msg(res.msg, {time: 1500}, function() {
                            window.location.reload();
                        });
                    } else {
                        layer.msg(res.msg, {time: 1500});
                    }
                }
            });
        });
    }
</script>

{include file="public/footer" /}
<script type="text/javascript">
    try{
        var mt20_1649209614 = sessionStorage.getItem("mt20_1649209614");
        if (mt20_1649209614 == 1){
            $("#geduan_div").removeClass("h15");
        } else {
            $("#geduan_div").addClass("h15");
        }
    }catch(e){}
</script>